package lab01;

import java.util.Scanner;

public class Test12 {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        System.out.println("请输入1~9999之间的数：");
        int num=s.nextInt();
        if(num>0&&num<9){
            System.out.println("这是一个个位数，回文");
        }
        if(num>9&&num<99) {
            System.out.println("这是一个十位数");
            int aa = num / 10;
            int i = num - (aa * 10);
            num = i * 10 + aa;
            System.out.println("回文为" + num);
        }
        if(num>99&&num<=999){
            System.out.println("这是一个百位数");
            int bb=num/100;
            int cc=num%100/10;
            int dd=num%10;
            num=dd*100+cc*10+bb;
            System.out.println(num);
        }
        if(num>999&&num<9999){
            System.out.println("这是一个千位数；");
            int ee=num/1000;
            int ff=num%1000/100;
            int gg=num%100/10;
            int dd=num%10;
            num=dd*1000+gg*100+ff*10+ee;
            System.out.println(num);
        }
        }
    }

